(function () {

    // fill the real data before use
    var cred = {
        number: "0000000000000000",
        password: "000000",
        month: "00",
        year: "00",
        cvv2: "00"
    };

    try {
        var $doc = $(document.frames.mainWorkArea.document);
        if ($doc.find("#CardNoCtrl").length) {

            // we are in the first page
            var bot = new ActiveXObject("Noria.Bot");
            bot.Fill($doc.find("#CardNoCtrl").get(0), cred.number, 0);

        } else if ($doc.find("#PwdCtrl").length) {

            // we are in the second page
            var bot = new ActiveXObject("Noria.Bot");
            bot.Fill($doc.find("#MonthCtrl").get(0), cred.month, 0);
            bot.Fill($doc.find("#YearCtrl").get(0), cred.year, 0);
            bot.Fill($doc.find("#CVV2Ctrl").get(0), cred.cvv2, 0);
            bot.Fill($doc.find("#PwdCtrl").get(0), cred.password, 0);

        } else {

            // unknown places
            alert("Where am I?");

        }
    }
    catch (e) {
        alert(e.toString());
    }

})();